const bodyParser = require('body-parser')
const express = require('express')
const cors = require('cors')
const app = express()

app.use(cors())
app.use(bodyParser.urlencoded({ extended: false }))
//配置虚拟目录
app.use(express.static('public'))
app.use("/public", express.static('public'))

// app.use(require('./utils/intercept.js')) // 不会拦截public
app.use('/', require('./utils/intercept.js'))

app.use('/api/user', require('./router/users.js'))
app.use('/api/products', require('./router/products.js'))
app.use('/api/category', require('./router/category.js'))
app.use('/api/account', require('./router/account.js'))
app.use('/api/utils', require('./router/utils.js'))

app.listen(8000, () => {
    console.log("服务器启动成功");
})
